package com.ssm.controller;

import com.ssm.model.User;
import com.ssm.service.UserService;
import com.ssm.util.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author Lenovo
 * @version 1.0
 * @description TODO
 * @date 3/11/2023 上午10:20
 */
@Controller
public class TestController {
    @Autowired
    private UserService userService;
    @RequestMapping("/dd")
    public String dd(HttpServletRequest request){
//        List<User> data = userService.findAll2();
//        request.setAttribute("data" ,data);
        ResultData all = userService.findAll();
        User data = (User) all.getData();
        request.setAttribute("data",data);
        return "success";
    }

    @RequestMapping("/update")
    public String up(){
        userService.update();
        return "success";
    }

}
